package com.jcl.core.db.constant;

/**
 * @ClassName DbProperty
 * @Author yyliu
 * @Date 2018/12/10 17:16
 * @Version 1.0
 **/
public class DbProperty {

    public static String PREFIX = "spring.datasource";
    public static final String SPLIT = ".";

    public static final String JDBC_DRIVER = "driverClassName";
    public static final String JDBC_URL = "url";
    public static final String JDBC_USERNAME = "username";
    public static final String JDBC_PASSWORD = "password";
    public static final String JDBC_initialSize = "initialSize";
    public static final String JDBC_minIdle = "minIdle";
    public static final String JDBC_maxActive = "maxActive";
    public static final String JDBC_maxWait = "maxWait";
    public static final String JDBC_timeBetweenEvictionRunsMillis = "timeBetweenEvictionRunsMillis";
    public static final String JDBC_minEvictableIdleTimeMillis = "minEvictableIdleTimeMillis";
    public static final String JDBC_validationQuery = "validationQuery";
    public static final String JDBC_testWhileIdle = "testWhileIdle";
    public static final String JDBC_testOnBorrow = "testOnBorrow";
    public static final String JDBC_testOnReturn = "testOnReturn";
    public static final String JDBC_poolPreparedStatements = "poolPreparedStatements";
    public static final String JDBC_maxPoolPreparedStatementPerConnectionSize = "maxPoolPreparedStatementPerConnectionSize";
    public static final String JDBC_logAbandoned = "logAbandoned";
    public static final String JDBC_removeAbandoned = "removeAbandoned";
    public static final String JDBC_removeAbandonedTimeout = "removeAbandonedTimeout";

    public static void setPrefix(String dataSourcePrefix) {
        DbProperty.PREFIX = dataSourcePrefix;
    }

    public static String getJdbcDriver() {

        return PREFIX + SPLIT +JDBC_DRIVER;
    }

    public static String getJdbcUrl() {
        return PREFIX + SPLIT +JDBC_URL;
    }

    public static String getUsername() {
        return PREFIX + SPLIT + JDBC_USERNAME;
    }

    public static String getPassword() {
        return PREFIX + SPLIT + JDBC_PASSWORD;
    }

    public static String getInitialSize() {
        return PREFIX + SPLIT + JDBC_initialSize;
    }

    public static String getMinIdle() {
        return PREFIX + SPLIT + JDBC_minIdle;
    }

    public static String getMaxActive() {
        return PREFIX + SPLIT + JDBC_maxActive;
    }

    public static String getMaxWait() {
        return PREFIX + SPLIT + JDBC_maxWait;
    }

    public static String getTimeBetweenEvictionRunsMillis() {
        return PREFIX + SPLIT + JDBC_timeBetweenEvictionRunsMillis;
    }

    public static String getMinEvictableIdleTimeMillis() {
        return PREFIX + SPLIT + JDBC_minEvictableIdleTimeMillis;
    }

    public static String getValidationQuery() {
        return PREFIX + SPLIT + JDBC_validationQuery;
    }

    public static String getTestWhileIdle() {
        return PREFIX + SPLIT + JDBC_testWhileIdle;
    }

    public static String getTestOnBorrow() {
        return PREFIX + SPLIT + JDBC_testOnBorrow;
    }

    public static String getTestOnReturn() {
        return PREFIX + SPLIT + JDBC_testOnReturn;
    }

    public static String getPoolPreparedStatements() {
        return PREFIX + SPLIT + JDBC_poolPreparedStatements;
    }

    public static String getMaxPoolPreparedStatementPerConnectionSize() {
        return PREFIX + SPLIT + JDBC_maxPoolPreparedStatementPerConnectionSize;
    }

    public static String getLogAbandoned() {
        return PREFIX + SPLIT + JDBC_logAbandoned;
    }

    public static String getRemoveAbandoned() {
        return PREFIX + SPLIT + JDBC_removeAbandoned;
    }

    public static String getRemoveAbandonedTimeout() {
        return PREFIX + SPLIT + JDBC_removeAbandonedTimeout;
    }
}
